package com.example.async.config;

import org.springframework.aop.interceptor.AsyncUncaughtExceptionHandler;

import java.lang.reflect.Method;

/**
 * @author zwzheng
 * @Classname MyAsyncExceptionHandler
 * @Description 异常处理
 * @Date 2021/1/5 11:58
 * @Version V1.0
 */
public class MyAsyncExceptionHandler implements AsyncUncaughtExceptionHandler {

    @Override
    public void handleUncaughtException(Throwable throwable,
                                        Method method, Object... objects) {

        System.out.println("----------异常捕获----------");
        System.out.println("Exception message:" + throwable.getMessage());
        System.out.println("Method name:" + method.getName());
        for (Object param:
             objects) {
            System.out.println("Parameter value:" + param);
        }

    }
}